<!--suppress ALL-->
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改库房列表')" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<form class="form-horizontal m" id="form-storeroom-edit" th:object="${storeroom}">
    <input name="storeroomId" th:field="*{storeroomId}" type="hidden">
    <div class="form-group">
        <label class="col-sm-3 control-label">库房名称：</label>
        <div class="col-sm-8">
            <input name="storeroomName" readonly th:field="*{storeroomName}" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">规格(个)：</label>
        <div class="col-sm-8">
            <input name="specification" readonly th:field="*{specification}" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">类型：</label>
        <div class="col-sm-8">
            <select name="storeroomType" disabled class="form-control m-b" th:with="type=${@dict.getType('storeroom_type')}" required>
                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{storeroomType}"></option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">创建人：</label>
        <div class="col-sm-8">
            <input name="founder" th:field="*{userName}" class="form-control" type="text" readonly>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">创建时间：</label>
        <div class="col-sm-8">
            <input name="createTime" th:value="*{#dates.format(createTime, 'yyyy-MM-dd HH:mm:ss')}" class="form-control" type="text" readonly>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">使用状态：</label>
        <div class="col-sm-8">
            <select name="useStatus" class="form-control m-b" disabled th:with="type=${@dict.getType('storeroom_use_status')}" required>
                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{useStatus}"></option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">库房状态：</label>
        <div class="col-sm-8">
            <select name="storeroomStatus" disabled class="form-control m-b" th:with="type=${@dict.getType('storeroom_status')}" required>
                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{storeroomStatus}"></option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">地址：</label>
        <div class="col-sm-8">
            <input name="address" readonly th:field="*{address}" class="form-control" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">附件：</label>
        <div class="col-sm-8">
            <input type="hidden" name="file" th:field="*{file}">
            <div class="file-loading">
                <input class="form-control file-upload" readonly id="file" name="file" type="file">
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">备注：</label>
        <div class="col-sm-8">
            <textarea name="note" readonly class="form-control">[[*{note}]]</textarea>
        </div>
    </div>
</form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "system/storeroom";
        $("#form-storeroom-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-storeroom-edit').serialize());
            }
        }

        $(".file-upload").each(function (i) {
            var val = $("input[name='" + this.id + "']").val()
            $(this).fileinput({
                'uploadUrl': ctx + 'common/upload',
                initialPreviewAsData: true,
                initialPreview: [val],
                maxFileCount: 1,
                autoReplace: true
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
            $(this).fileinput('_initFileActions');
        });
    </script>
</body>
</html>